package com.study.designmodes.enums;

import lombok.Generated;

import java.util.Objects;

/**
 * 业务枚举
 *
 * @author yyb8152
 * @since 20220402
 **/
public enum BusinessCodeEnum {
    DECLARE_INSURANCE_REGISTER("DECLARE_INSURANCE_REGISTER", "企业职工参保登记"),
    DECLARE_INSURANCE_STOP("DECLARE_INSURANCE_STOP", "企业职工停保"),
    /**
     * 默认业务，实际业务中不会使用，用于通用的处理
     */
    DEFAULT("DEFAULT", "默认");

    private final String code;
    private final String desc;

    public static BusinessCodeEnum getByCode(String code) {
        BusinessCodeEnum[] var1 = values();
        int var2 = var1.length;

        for (int var3 = 0; var3 < var2; ++var3) {
            BusinessCodeEnum obj = var1[var3];
            if (Objects.equals(obj.code, code)) {
                return obj;
            }
        }

        return null;
    }

    public static BusinessCodeEnum getByDesc(String desc) {
        BusinessCodeEnum[] var1 = values();
        int var2 = var1.length;

        for (int var3 = 0; var3 < var2; ++var3) {
            BusinessCodeEnum obj = var1[var3];
            if (Objects.equals(obj.desc, desc)) {
                return obj;
            }
        }

        return null;
    }

    @Generated
    public String getCode() {
        return this.code;
    }

    @Generated
    public String getDesc() {
        return this.desc;
    }

    @Generated
    private BusinessCodeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }


}
